package com.example.gzysmartcity.ui.adapter;

import android.webkit.WebView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.gzysmartcity.R;
import com.example.gzysmartcity.repository.model.SCNewsComment;

import org.jetbrains.annotations.NotNull;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class NewsXpRvAdapter extends BaseQuickAdapter<SCNewsComment.DataBean, BaseViewHolder> {
    public NewsXpRvAdapter(int layoutResId) {
        super(layoutResId);
        mSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd kk:mm", Locale.CHINA);
    }
    private SimpleDateFormat mSimpleDateFormat;
    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, SCNewsComment.DataBean dataBean) {
        baseViewHolder.setText(R.id.tv_rv_newxq_name,dataBean.getAuthor()+": ");
        baseViewHolder.setText(R.id.tv_rv_newxq_time,mSimpleDateFormat.format(new Date((long) dataBean.getCreateTime() * 1000)));
        WebView webView=(WebView) baseViewHolder.getView(R.id.rv_newxq_webView);
        webView.loadData(dataBean.getContent(), "text/html", "utf-8");

    }
}
